// pages/workPage/workPage.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    indicatorDots: true, //是否显示面板指示点
    autoplay: true, //是否自动切换
    interval: 3000, //自动切换时间间隔
    duration: 800, //滑动动画时长
    circular: true, //是否采用衔接滑动
    imgUrls: [
      'https://img-qn.51miz.com/preview/photo/00/01/53/28/P-1532838-5908DFD9.jpg',
      'https://img-qn.51miz.com/preview/photo/00/01/52/83/P-1528311-1C44E3EF.jpg',
      'https://img-qn.51miz.com/preview/photo/00/01/55/88/P-1558844-90D5E331.jpg',
      'https://img-qn.51miz.com/preview/photo/00/01/50/02/P-1500202-4293BF6BO.jpg',
      'https://img-qn.51miz.com/preview/photo/00/01/52/83/P-1528372-D467DB64.jpg'
    ],
    navBarList: [{
      text: '功能1',
      attribute: 'fun1'
    }, {
      text: '功能2',
      attribute: 'fun2'
    }, {
      text: '功能3',
      attribute: 'fun3'
    }, {
      text: '功能4',
      attribute: 'fun4'
    }, {
      text: '功能5',
      attribute: 'fun5'
    }],
    girdList: [{
      text: '功能A',
      attribute: 'funA'
    }, {
      text: '功能B',
      attribute: 'funB'
    }, {
      text: '功能C',
      attribute: 'funC'
    }, {
      text: '功能D',
      attribute: 'funD'
    }, {
      text: '功能E',
      attribute: 'funE'
    }, {
      text: '功能F',
      attribute: 'funF'
    }, {
      text: '功能G',
      attribute: 'funG'
    }, {
      text: '功能H',
      attribute: 'funH'
    }, {
      text: '功能I',
      attribute: 'funI'
    }, {
      text: '功能J',
      attribute: 'funJ'
    }, {
      text: '',
      attribute: ''
    }, {
      text: '',
      attribute: ''
    }],
    funBShow: false,
    selectFunText: "",
    colorArr: [
      "#83DDA8",
      "#78D9E4",
      "#B37BF5",
      "#8C99FD",
      "#72B9FE",
    ],
  },
  onNavToDetail(e) {
    console.log(e)
    const attribute = e.currentTarget.dataset.attribute
    const text = e.currentTarget.dataset.text
    this.setData({
      selectFunText: text
    })
    if (attribute == 'funB') {
      this.setData({
        funBShow: true,
      })
    } else {
      wx.showToast({
        title: attribute,
        icon: 'none'
      })
    }
  },
  onClose() {
    this.setData({
      funBShow: false
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
      this.getTabBar().setData({
        selected: 0
      })
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})